@use "sass:meta";

// Name:            Comment
// Description:     Component to create nested comments
//
// Component:       `uk-comment`
//
// Sub-objects:     `uk-comment-body`
//                  `uk-comment-header`
//                  `uk-comment-title`
//                  `uk-comment-meta`
//                  `uk-comment-avatar`
//                  `uk-comment-list`
//
// Modifier:        `uk-comment-primary`
//
// ========================================================================


// Variables
// ========================================================================






/* ========================================================================
   Component: Comment
 ========================================================================== */

.uk-comment {
    @if(meta.mixin-exists(hook-comment)) {@include hook-comment();}
}


/* Sections
 ========================================================================== */

.uk-comment-body {
    display: flow-root;
    overflow-wrap: break-word;
    word-wrap: break-word;
    @if(meta.mixin-exists(hook-comment-body)) {@include hook-comment-body();}
}

.uk-comment-header {
    display: flow-root;
    margin-bottom: $comment-header-margin-bottom;
    @if(meta.mixin-exists(hook-comment-header)) {@include hook-comment-header();}
}

/*
 * Remove margin from the last-child
 */

.uk-comment-body > :last-child,
.uk-comment-header > :last-child { margin-bottom: 0; }


/* Title
 ========================================================================== */

.uk-comment-title {
    font-size: $comment-title-font-size;
    line-height: $comment-title-line-height;
    @if(meta.mixin-exists(hook-comment-title)) {@include hook-comment-title();}
}


/* Meta
 ========================================================================== */

.uk-comment-meta {
    font-size: $comment-meta-font-size;
    line-height: $comment-meta-line-height;
    color: $comment-meta-color;
    @if(meta.mixin-exists(hook-comment-meta)) {@include hook-comment-meta();}
}


/* Avatar
 ========================================================================== */

.uk-comment-avatar {
    @if(meta.mixin-exists(hook-comment-avatar)) {@include hook-comment-avatar();}
}


/* List
 ========================================================================== */

.uk-comment-list {
    padding: 0;
    list-style: none;
}

/* Adjacent siblings */
.uk-comment-list > :nth-child(n+2) {
    margin-top: $comment-list-margin-top;
    @if(meta.mixin-exists(hook-comment-list-adjacent)) {@include hook-comment-list-adjacent();}
}

/*
 * Sublists
 * Note: General sibling selector allows reply block between comment and sublist
 */

.uk-comment-list .uk-comment ~ ul {
    margin: $comment-list-margin-top 0 0 0;
    padding-left: $comment-list-padding-left;
    list-style: none;
    @if(meta.mixin-exists(hook-comment-list-sub)) {@include hook-comment-list-sub();}
}

/* Tablet and bigger */
@media (min-width: $breakpoint-medium) {

    .uk-comment-list .uk-comment ~ ul { padding-left: $comment-list-padding-left-m; }

}

/* Adjacent siblings */
.uk-comment-list .uk-comment ~ ul > :nth-child(n+2) {
    margin-top: $comment-list-margin-top;
    @if(meta.mixin-exists(hook-comment-list-sub-adjacent)) {@include hook-comment-list-sub-adjacent();}
}


/* Style modifier
 ========================================================================== */

.uk-comment-primary {
    @if(meta.mixin-exists(hook-comment-primary)) {@include hook-comment-primary();}
}


// Hooks
// ========================================================================

@if(meta.mixin-exists(hook-comment-misc)) {@include hook-comment-misc();}

// @mixin hook-comment(){}
// @mixin hook-comment-body(){}
// @mixin hook-comment-header(){}
// @mixin hook-comment-title(){}
// @mixin hook-comment-meta(){}
// @mixin hook-comment-avatar(){}
// @mixin hook-comment-list-adjacent(){}
// @mixin hook-comment-list-sub(){}
// @mixin hook-comment-list-sub-adjacent(){}
// @mixin hook-comment-primary(){}
// @mixin hook-comment-misc(){}
